<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在script中使用text/x-template 指定一个id 将id赋给template</title>
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/iview.min.js"></script>
    <link rel="stylesheet" href="../../css/iview.css">
</head>
<body>
<div id="app">
    <my-component></my-component>
    <script type="text/x-template" id="my-component">
        <div>这是组件的内容</div>
    </script>
</div>
<script>
    Vue.component('my-component', {
        template: "#my-component"
    });
    var app = new Vue({
        el: "#app",
        data: {
            books: [
                {name: '《《Vue.js实战》》', author: "杨翼凡"},
                {name: '《《JavaScript语言精粹》》', author: "杨翼凡"},
                {name: '《《JavaScript高级程序设计》》', author: "杨翼凡"}
            ]
        }
    })
</script>
</body>
</html>